import server from './http.js' //导入axios

//首页轮播carousel
const carousel = () => {
   let data = server.post('/resources/carousel')
   return data
}
// 登录
const aLogin = (msg) => {
   let data = server.post('/users/login', msg)
   return data
}
// 注册
const register = (msg) => {
   let data = server.post('users/register', msg)
   return data
}
// 购物车
const shoppingCart = (msg) => {
   let data = server.post('/user/shoppingCart/getShoppingCart', msg)
   return data
}
// 首页所有商品名
const shopAll=()=>{
   let data=server.post('/product/getCategory')
   return data
}
// 手机列表
const getPhone=(res)=>{
   let data=server.post('/product/getPromoProduct',{categoryName:"手机"})
   return data
}
// 家电列表
const getElectricAppliance=(res)=>{
   let data=server.post('/product/getHotProduct',{categoryName:res})
   return data
}
// 配件列表
const getParts=(res)=>{
   let data=server.post('/product/getHotProduct',{categoryName:res})
   return data
}

// 详情页数据
const getDetails=(res)=>{
   let data=server.post("/product/getDetails",res)
   return data
}
// 详情页数据
const getDetailsTu=(res)=>{
   let data=server.post("/product/getDetailsPicture",res)
   return data
}

// 全部商品  分页
const getAllShop=(res)=>{
   let data=server.post("/product/getAllProduct",res)
   return data
}
const getAllShops=(res)=>{
   let data=server.post("/product/getProductByCategory",res)
   return data
}

// 订单详情
const getOrder=(res)=>{
   let data=server.post("/user/order/getOrder",res)
   return data
}


// 收藏详情
const getCollect=(res)=>{
   let data=server.post("/user/collect/getCollect",res)
   return data
}
// 购物车详情
const getShop=(res)=>{
   let data=server.post("user/shoppingCart/getShoppingCart",res)
   return data
}

// 搜索
const getSearch=(res)=>{
   let data=server.post("product/getProductBySearch".res)
   return data
}

// 购物车删除
const delShop=(res)=>{
   let data=server.post("/user/shoppingCart/deleteShoppingCart",res)
   return data
}
// 购物车加入
const addShop=(res)=>{
   let data=server.post("/user/shoppingCart/addShoppingCart",res)
   return data
}
// 订单加入
const addOrder=(res)=>{
   let data=server.post("/user/order/addOrder",res)
   return data
}
// 收藏删除
const delCollect=(res)=>{
   let data=server.post("/user/collect/deleteCollect",res)
   return data
}
// 收藏加入
const addCollect=(res)=>{
   let data=server.post("/user/collect/addCollect",res)
   return data
}


export {
   carousel,
   aLogin,
   shoppingCart,
   shopAll,
   getPhone,
   getElectricAppliance,
   getParts,
   getDetails,
   getDetailsTu,
   getAllShop,
   getOrder,
   getCollect,
   getShop,
   register,
   getSearch,
   getAllShops,
   delShop,
   addShop,
   addOrder,
   delCollect,
   addCollect
}